package com.wei.provider.controller;

import com.wei.entity.User;
import com.wei.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/user")
@RefreshScope
public class UserController {
    @Autowired
    private UserService userService;
    @Value("${spring.application.name}")
    private String applicationName;
    @Value("${eureka.instance.lease-renewal-interval-in-seconds}")
    private String leaseRenewalIntervalInSeconds;

    private static List<String> list = new ArrayList<>();

    @GetMapping("/getOne")
    public User getOne(){
        System.out.println(applicationName);
        return userService.getOne();
    }

    @GetMapping("/getValue")
    public String getValue(){
        return leaseRenewalIntervalInSeconds;
    }
}
